package org.gwtEss.table.colAdapter;

import org.gwtEss.other.ChkBox;
import org.gwtEss.table.FilterMenuItem;
import org.gwtEss.table.SmartUserManagedColWidget;

import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant;
public class FilterMenuCheckBoxColAdapter extends SmartUserManagedColWidget<FilterMenuItem, ChkBox>{
	static HTML tagStripper = new HTML();
	public FilterMenuCheckBoxColAdapter(String colName) {
		super(colName);
		// TODO Auto-generated constructor stub
	}
	public FilterMenuCheckBoxColAdapter() {
		super("");
	}
	@Override
	public ChkBox createColWidgetInstance() {
		return new ChkBox();
	}

	@Override
	public boolean resetData(ChkBox w, FilterMenuItem data) {
		data.setChecked(w.getValue());
//		onValueChange(data);
		return true;
	}

	@Override
	public void resetWidget(FilterMenuItem data, ChkBox w) {
		w.setValue(data.isChecked());
		tagStripper.setHTML(data.getDisplayTxt());
		String txt = tagStripper.getText();
		w.setText(txt);
		w.setTitle(txt);
	}
//	public abstract void onValueChange(FilterMenuItem data);//Remove this method if it is not used. 
}
